home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / mini / Partition < prev    next >
Text File  |  1997-11-03  |  30KB  |  573 lines

  1.   Linux Partition HOWTO
  2.   Kristan Koehntopp, kris@koehntopp.de
  3.   $Id: howto.sgml,v 2.4 1997/11/03 06:27:22 kris Exp $
  4.  
  5.   This Linux Mini-HOWTO teaches you how to plan and layout disk space
  6.   for your Linux system. It talks about disk hardware, partitions, swap
  7.   space sizing and positioning considerations. file systems, file system
  8.   types and related topics. The intent is to teach some background
  9.   knowledge, not procedures.
  10.  
  11.   1.  Introduction
  12.  
  13.   1.1.  What is this?
  14.  
  15.   This is a Linux Mini-HOWTO text. A Mini-HOWTO is a small text
  16.   explaining some business related to Linux installation and maintenance
  17.   tutorial style. It's mini, because either the text or the topic it
  18.   discusses are too small for a real HOWTO or even a book. A HOWTO is
  19.   not a reference:  that's what manual pages are for.
  20.  
  21.   1.2.  What is in it? and related HOWTO documents
  22.  
  23.   This particular Mini-HOWTO teaches you how to plan and layout disk
  24.   space for your Linux system. It talks about disk hardware, partitions,
  25.   swap space sizing and positioning considerations, file systems, file
  26.   system types and related topics. The intent is to teach some
  27.   background knowlegde, so we are talking mainly principles and not
  28.   tools in this text.
  29.  
  30.   Ideally, this document should be read before your first installation,
  31.   but this is somehow difficult for most people.  First timers have
  32.   other problems than disk layout optimization, too. So you are probably
  33.   someone who just finished a Linux installation and is now thinking
  34.   about ways to optimize this installation or how to avoid some nasty
  35.   miscalculations in the next one. Well, expect some desire to tear down
  36.   and rebuild your installation when you are finished with this text.
  37.   :-)
  38.  
  39.   This Mini-HOWTO limits itself to planning and layouting disk space
  40.   most of the time. It does not discuss the usage of fdisk, LILO, mke2fs
  41.   or backup programs. There are other HOWTOs that address these
  42.   problems. Please see the Linux HOWTO Index for current information on
  43.   Linux HOWTOs. There are instructions for obtaining HOWTO documents in
  44.   the index, too.
  45.  
  46.   To learn how to estimate the various size and speed requirements for
  47.   different parts of the filesystem, see "Linux Multiple Disks Layout
  48.   mini-HOWTO", by Gjoen Stein <gjoen@nyx.net>.
  49.  
  50.   For instructions and considerations regarding disks with more than
  51.   1024 cylinders, see "Linux Large Disk mini-HOWTO", Andries Brouwer
  52.   <aeb@cwi.nl>.
  53.  
  54.   For instructions on limiting disk space usage per user (quotas), see
  55.   "Linux Quota mini-HOWTO", by Albert M.C. Tam <bertie@scn.org>
  56.  
  57.   Currently, there is no general document on disk backup, but there are
  58.   several documents with pointers to specific backup solutions. See
  59.   "Linux ADSM Backup mini-HOWTO", by Thomas Koenig
  60.   <Thomas.Koenig@ciw.uni-karlsruhe.de> for instructions on integrating
  61.   Linux into an IBM ADSM backup environment. See "Linux Backup with
  62.   MSDOS mini-HOWTO", by Christopher Neufeld
  63.   <neufeld@physics.utoronto.ca> for information about MS-DOS driven
  64.   Linux backups.
  65.  
  66.   For instructions on writing and submitting a HOWTO document, see the
  67.   Linux HOWTO Index, by Greg Hankins <gregh@sunsite.unc.edu>.
  68.  
  69.   Browsing through /usr/src/linux/Documentation can be very instructive,
  70.   too. See ide.txt and scsi.txt for some background information on the
  71.   properties of your disk drivers and have a look at the filesystems/
  72.   subdirectory.
  73.  
  74.   2.  What is a partition anyway?
  75.  
  76.   When PC hard disks were invented people soon wanted to install
  77.   multiple operating systems, even if their system had only one disk.
  78.   So a mechanism was needed to divide a single physical disk into
  79.   multiple logical disks. So that's what a partition is: A contiguous
  80.   section of blocks on your hard disk that is treated like a completely
  81.   seperate disk by most operating systems.
  82.  
  83.   It is fairly clear that partitions must not overlap: An operating
  84.   system will certainly not be pleased, if another operating system
  85.   installed on the same machine were overwriting important information
  86.   because of overlapping partitions. There should be no gap between
  87.   adjacent partitions, too. While this constellation is not harmful, you
  88.   are wasting precious disk space by leaving space between partitions.
  89.  
  90.   A disk need not be partitioned completely. You may decide to leave
  91.   some space at the end of your disk that is not assigned to any of your
  92.   installed operating systems, yet. Later, when it is clear which
  93.   installation is used by you most of the time, you can partition this
  94.   left over space and put a file system on it.
  95.  
  96.   Partitions can not be moved nor can they be resized without destroying
  97.   the file system contained in it. So repartitioning usually involves
  98.   backup and restore of all file systems touched during the
  99.   repartitioning.  In fact it is fairly common to mess up things
  100.   completely during repartitioning, so you should back up anything on
  101.   any disk on that particular machine before even touching things like
  102.   fdisk.
  103.  
  104.   Well, some partitions with certain file system types on them actually
  105.   can be split into two without losing any data (if you are lucky). For
  106.   example there is a program called "fips" for splitting MS-DOS
  107.   partitions into two to make room for a Linux installation without
  108.   having to reinstall MS-DOS. You are still not going to touch these
  109.   things without carefully backing up everything on that machine, aren't
  110.   you?
  111.  
  112.   2.1.  Backups are important
  113.  
  114.   Tapes are your friend for backups. They are fast, reliable and easy to
  115.   use, so you can make backups often, preferably automatically and
  116.   without hassle.
  117.  
  118.   Step on soapbox: And I am talking about real tapes, not that disk
  119.   controller driven ftape crap. Consider buying SCSI: Linux does support
  120.   SCSI natively. You don't need to load ASPI drivers, you are not losing
  121.   precious HMA under Linux and once the SCSI host adapter is installed,
  122.   you just attach additional disks, tapes and CD-ROMs to it. No more I/O
  123.   addresses, IRQ juggling or Master/Slave and PIO-level matching.
  124.   Plus: Proper SCSI host adapters give you high I/O performance without
  125.   much CPU load. Even under heavy disk activity you will experience good
  126.   response times. If you are planning to use a Linux system as a major
  127.   USENET news feed or if you are about to enter the ISP business, don't
  128.   even think about deploying a system without SCSI. Climb of soapbox.
  129.  
  130.   2.2.  Device numbers and device names
  131.  
  132.   The number of partitions on an Intel based system was limited from the
  133.   very beginning: The original partition table was installed as part of
  134.   the boot sector and held space for only four partition entries.  These
  135.   partitions are now called primary partitions. When it became clear
  136.   that people needed more partitions on their systems, logical
  137.   partitions were invented.  The number of logical partitions is not
  138.   limited: Each logical partition contains a pointer to the next logical
  139.   partition, so you can have a potentially unlimited chain of partition
  140.   entries.
  141.  
  142.   For compatibility reasons, the space occupied by all logical
  143.   partitions had to be accounted for. If you are using logical
  144.   partitions, one primary partition entry is marked as "extended
  145.   partition" and its starting and ending block mark the area occupied by
  146.   your logical partitions. This implies that the space assigned to all
  147.   logical partitions has to be contiguous.  There can be only one
  148.   extended partition: no fdisk program will create more than one
  149.   extended partition.
  150.  
  151.   Linux cannot handle more than a limited number of partitions per
  152.   drive. So in Linux you have 4 primary partitions (3 of them useable,
  153.   if you are using logical partitions) and at most 15 partitions
  154.   altogether on an SCSI disk (63 altogether on an IDE disk).
  155.  
  156.   In Linux, partitions are represented by device files. A device file is
  157.   a file with type c (for "character" devices, devices that do not use
  158.   the buffer cache) or b (for "block" devices, which go through the
  159.   buffer cache). In Linux, all disks are represented as block devices
  160.   only. Unlike other Unices, Linux does not offer "raw" character
  161.   versions of disks and their partitions.
  162.  
  163.   The only important thing with a device file are its major and minor
  164.   device number, shown instead of the files size:
  165.  
  166.        ______________________________________________________________________
  167.        $ ls -l /dev/hda
  168.        brw-rw----   1 root     disk       3,   0 Jul 18  1994 /dev/hda
  169.                                           ^    ^
  170.                                           |    minor device number
  171.                                           major device number
  172.        ______________________________________________________________________
  173.  
  174.   When accessing a device file, the major number selects which device
  175.   driver is being called to perform the input/output operation. This
  176.   call is being done with the minor number as a parameter and it is
  177.   entirely up to the driver how the minor number is being interpreted.
  178.   The driver documentation usually describes how the driver uses minor
  179.   numbers. For IDE disks, this documentation is in
  180.   /usr/src/linux/Documentation/ide.txt.  For SCSI disks, one would
  181.   expect such documentation in /usr/src/linux/Documentation/scsi.txt,
  182.   but it isn't there. One has to look at the driver source to be sure
  183.   (/usr/src/linux/driver/scsi/sd.c:184-196). Fortunately, there is Peter
  184.   Anvin's list of device numbers and names in
  185.   /usr/src/linux/Documentation/devices.txt; see the entries for block
  186.   devices, major 3, 22, 33, 34 for IDE and major 8 for SCSI disks. The
  187.   major and minor numbers are a byte each and that is why the number of
  188.   partitions per disk is limited.
  189.  
  190.   By convention device files have certain names and many system programs
  191.   have knowledge about these names compiled in. They expect your IDE
  192.   disks to be named /dev/hd* and your SCSI disks to be named /dev/sd*.
  193.   Disks are numbered a, b, c and so on, so /dev/hda is your first IDE
  194.   disk and /dev/sda is your first SCSI disk. Both devices represent
  195.   entire disks, starting at block one.  Writing to these devices with
  196.   the wrong tools will destroy the master boot loader and partition
  197.   table on these disks, rendering all data on this disk unusable or
  198.   making your system unbootable. Know what you are doing and, again,
  199.   back up before you do it.
  200.  
  201.   Primary partitions on a disk are 1, 2, 3 and 4. So /dev/hda1 is the
  202.   first primary partition on the first IDE disk and so on.  Logical
  203.   partitions have numbers 5 and up, so /dev/sdb5 is the first logical
  204.   partition on the second SCSI disk.
  205.  
  206.   Each partition entry has a starting and an ending block address
  207.   assigned to it and a type. The type is a numerical code (a byte) which
  208.   designates a particular partition to a certain type of operating
  209.   system. For the benefit of computing consultants partition type codes
  210.   are not really unique, so there is always the probability of two
  211.   operating systems using the same type code.
  212.  
  213.   Linux reserves the type code 0x82 for swap partitions and 0x83 for
  214.   "native" file systems (that's ext2 for almost all of you).  The once
  215.   popular, now outdated Linux/Minix file system used the type code 0x81
  216.   for partitions. OS/2 marks it's partitions with a 0x07 type and so
  217.   does Windows NT's NTFS. MS-DOS allocates several type codes for its
  218.   various flavors of FAT file systems: 0x01, 0x04 and 0x06 are known.
  219.   DR-DOS used 0x81 to indicate protected FAT partitions, creating a type
  220.   clash with Linux/Minix at that time, but neither Linux/Minix nor DR-
  221.   DOS are widely used any more. The extended partition which is used as
  222.   a container for logical partitions has a type of 0x05, by the way.
  223.  
  224.   Partitions are created and deleted with the fdisk program.  Every self
  225.   respecting operating system program comes with an fdisk and
  226.   traditionally it is even called fdisk (or FDISK.EXE) in almost all
  227.   OSes. Some fdisks, noteable the DOS one, are somehow limited when they
  228.   have to deal with other operating systems partitions. Such limitations
  229.   include the complete inability to deal with anything with a foreign
  230.   type code, the inability to deal with cylinder numbers above 1024 and
  231.   the inability to create or even understand partitions that do not end
  232.   on a cylinder boundary. For example, the MS-DOS fdisk can't delete
  233.   NTFS partitions, the OS/2 fdisk has been known to silently "correct"
  234.   partitions created by the Linux fdisk that do not end on a cylinder
  235.   boundary and both, the DOS and the OS/2 fdisk, have had problems with
  236.   disks with more than 1024 cylinders (see the "large-disk" Mini-Howto
  237.   for details on such disks).
  238.  
  239.   3.  What Partitions do I need?
  240.  
  241.   3.1.  How many partitions do I need?
  242.  
  243.   Okay, so what partitions do you need? Well, some operating systems do
  244.   not believe in booting from logical partitions for reasons that are
  245.   beyond the scope of any sane mind. So you probably want to reserve
  246.   your primary partitions as boot partitions for your MS-DOS, OS/2 and
  247.   Linux or whatever you are using. Remember that one primary partition
  248.   is needed as an extended partition, which acts as a container for the
  249.   rest of your disk with logical partitions.
  250.  
  251.   Booting operating systems is a real-mode thing involving BIOSes and
  252.   1024 cylinder limitations. So you probably want to put all your boot
  253.   partitions into the first 1024 cylinders of your hard disk, just to
  254.   avoid problems. Again, read the "large-disk" Mini-Howto for the gory
  255.   details.
  256.  
  257.   To install Linux, you will need at least one partition. If the kernel
  258.   is loaded from this partition (for example by LILO), this partition
  259.   must be readable by your BIOS. If you are using other means to load
  260.   your kernel (for example a boot disk or the LOADLIN.EXE MS-DOS based
  261.   Linux loader) the partition can be anywhere. In any case this
  262.   partition will be of type 0x83 "Linux native".
  263.  
  264.   Your system will need some swap space. Unless you swap to files you
  265.   will need a dedicated swap partition. Since this partition is only
  266.   accessed by the Linux kernel and the Linux kernel does not suffer from
  267.   PC BIOS deficiencies, the swap partition may be positioned anywhere.
  268.   I recommed using a logical partition for it (/dev/?d?5 and higher).
  269.   Dedicated Linux swap partitions are of type 0x82 "Linux swap".
  270.  
  271.   These are minimal partition requirements. It may be useful to create
  272.   more partitions for Linux. Read on.
  273.  
  274.   3.2.  How large should my swap space be?
  275.  
  276.   If you have decided to use a dedicated swap partition, which is
  277.   generally a Good Idea tm, follow these guidelines for estimating its
  278.   size:
  279.  
  280.   ╖  In Linux RAM and swap space add up (This is not true for all
  281.      Unices). For example, if you have 8 MB of RAM and 12 MB swap space,
  282.      you have a total of about 20 MB virtual memory.
  283.  
  284.   ╖  When sizing your swap space, you should have at least 16 MB of
  285.      total virtual memory. So for 4 MB of RAM consider at least 12 MB of
  286.      swap, for 8 MB of RAM consider at least 8 MB of swap.
  287.  
  288.   ╖  In Linux, a single swap partition can not be larger than 128 MB.
  289.      That is, the partition may be larger than 128 MB, but excess space
  290.      is never used. If you want more than 128 MB of swap, you have to
  291.      create multiple swap partitions.
  292.  
  293.   ╖  When sizing swap space, keep in mind that too much swap space may
  294.      not be useful at all.
  295.  
  296.      Every process has a "working set". This is a set of in-memory pages
  297.      which will be referenced by the processor in the very near future.
  298.      Linux tries to predict these memory accesses (assuming that
  299.      recently used pages will be used again in the near future) and
  300.      keeps these pages in RAM if possible. If the program has a good
  301.      "locality of reference" this assumption will be true and prediction
  302.      algorithm will work.
  303.  
  304.      Holding a working set in main memory does only work if there is
  305.      enough main memory. If you have too many processes running on a
  306.      machine, the kernel is forced to put pages on disk that it will
  307.      reference again in the very near future (forcing a page-out of a
  308.      page from another working set and then a page-in of the page
  309.      referenced). Usually this results in a very heavy increase in
  310.      paging activity and in a sustantial drop of performance. A machine
  311.      in this state is said to be "thrashing" (For you german readers:
  312.      That's "thrashing" ("dreschen", "schlagen", "haemmern") and not
  313.      trashing ("muellen")).
  314.  
  315.      On a thrashing machine the processes are essentially running from
  316.      disk and not from RAM. Expect performance to drop by approximately
  317.      the ratio between memory access speed and disk access speed.
  318.  
  319.      A very old rule of thumb in the days of the PDP and the Vax was
  320.      that the size of the working set of a program is about 25% of its
  321.      virtual size. Thus it is probably useless to provide more swap than
  322.      three times your RAM.
  323.  
  324.      But keep in mind that this is just a rule of thumb. It is easily
  325.      possible to create scenarios where programs have extremely large or
  326.      extremely small working sets. For example, a simulation program
  327.      with a large data set that is accessed in a very random fashion
  328.      would have almost no noticeable locality of reference in its data
  329.      segment, so its working set would be quite large.
  330.  
  331.      On the other hand, an xv with many simultaneously opened JPEGs, all
  332.      but one iconified, would have a very large data segment. But image
  333.      transformations are all done on one single image, most of the
  334.      memory occupied by xv is never touched.  The same is true for an
  335.      editor with many editor windows where only one window is being
  336.      modified at a time.  These programs have - if they are designed
  337.      properly - a very high locality of reference and large parts of
  338.      them can be kept swapped out without too severe performance impact.
  339.  
  340.      One could suspect that the 25% number from the age of the command
  341.      line is no longer true for modern GUI programs editing multiple
  342.      documents, but I know of no newer papers that try to verify these
  343.      numbers.
  344.  
  345.   So for a configuration with 16 MB RAM, no swap is needed for a minimal
  346.   configuration and more than 48 MB of swap are probably useless. The
  347.   exact amount of memory needed depends on the application mix on the
  348.   machine (what did you expect?).
  349.  
  350.   3.3.  Where should I put my swap space?
  351.  
  352.   ╖  Mechanics are slow, electronics are fast.
  353.  
  354.      Modern hard disks have many heads. Switching between heads of the
  355.      same track is fast, since it is purely electronic.  Switching
  356.      between tracks is slow, since it involves moving real world matter.
  357.  
  358.      So if you have a disk with many heads and one with less heads and
  359.      both are identical in other parameters, the disk with many heads
  360.      will be faster.
  361.  
  362.      Splitting swap and putting it on both disks will be even faster,
  363.      though.
  364.  
  365.   ╖  Older disks have the same number of sectors on all tracks.  With
  366.      this disks it will be fastest to put your swap in the middle of the
  367.      disks, assuming that your disk head will move from a random track
  368.      towards the swap area.
  369.  
  370.   ╖  Newer disks use ZBR (zone bit recording). They have more sectors on
  371.      the outer tracks. With a constant number of rpms, this yields a far
  372.      greater performance on the outer tracks than on the inner ones. Put
  373.      your swap on the fast tracks.
  374.  
  375.   ╖  Of course your disk head will not move randomly. If you have swap
  376.      space in the middle of a disk between a constantly busy home
  377.      partition and an almost unused archive partition, you would be
  378.      better of if your swap were in the middle of the home partition for
  379.      even shorter head movements. You would be even better off, if you
  380.      had your swap on another otherwise unused disk, though.
  381.  
  382.   Summary: Put your swap on a fast disk with many heads that is not busy
  383.   doing other things. If you have multiple disks: Split swap and scatter
  384.   it over all your disks or even different controllers.
  385.  
  386.   Even better: Buy more RAM.
  387.  
  388.   3.4.  Some facts about file systems and fragmentation
  389.  
  390.   Disk space is administered by the operating system in units of blocks
  391.   and fragments of blocks. In ext2, fragments and blocks have to be of
  392.   the same size, so we can limit our discussion to blocks.
  393.  
  394.   Files come in any size. They don't end on block boundaries.  So with
  395.   every file a part of the last block of every file is wasted. Assuming
  396.   that file sizes are random, there is approximately a half block of
  397.   waste for each file on your disk.  Tanenbaum calls this "internal
  398.   fragmentation" in his book "Operating Systems".
  399.  
  400.   You can guess the number of files on your disk by the number of
  401.   allocated inodes on a disk. On my disk
  402.  
  403.        ______________________________________________________________________
  404.        # df -i
  405.        Filesystem           Inodes   IUsed   IFree  %IUsed Mounted on
  406.        /dev/hda3              64256   12234   52022    19%  /
  407.        /dev/hda5              96000   43058   52942    45%  /var
  408.        ______________________________________________________________________
  409.  
  410.   there are about 12000 files on / and about 44000 files on /var.  At a
  411.   block size of 1 KB, about 6+22 = 28 MB of disk space are lost in the
  412.   tail blocks of files. Had I chosen a block size of 4 KB, I had lost 4
  413.   times this space.
  414.  
  415.   Data transfer is faster for large contiguous chunks of data, though.
  416.   That's why ext2 tries to preallocate space in units of 8 contigous
  417.   blocks for growing files. Unused preallocation is released when the
  418.   file is closed, so no space is wasted.
  419.  
  420.   Noncontiguous placement of blocks in a file is bad for performance,
  421.   since files are often accessed in a sequential manner. It forces the
  422.   operating system to split a disk access and the disk to move the head.
  423.   This is called "external fragmentation" or simply "fragmentation" and
  424.   is a common problem with DOS file systems.
  425.  
  426.   ext2 has several strategies to avoid external fragmentation.  Normally
  427.   fragmentation is not a large problem in ext2, not even on heavily used
  428.   partitions such as a USENET news spool. While there is a tool for
  429.   defragmentation of ext2 file systems, nobody ever uses it and it is
  430.   not up to date with the current release of ext2. Use it, but do so on
  431.   your own risk.
  432.  
  433.   The MS-DOS file system is well known for its pathological managment of
  434.   disk space. In conjunction with the abysmal buffer cache used by MS-
  435.   DOS the effects of file fragmentation on performance are very
  436.   noticeable. DOS users are accustomed to defragging their disks every
  437.   few weeks and some have even developed some ritualistic beliefs
  438.   regarding defragmentation.  None of these habits should be carried
  439.   over to Linux and ext2.  Linux native file systems do not need
  440.   defragmentation under normal use and this includes any condition with
  441.   at least 5% of free space on a disk.
  442.  
  443.   The MS-DOS file system is also known to lose large amounts of disk
  444.   space due to internal fragmentation. For partitions larger than 256
  445.   MB, DOS block sizes grow so large that they are no longer useful (This
  446.   has been corrected to some extent with FAT32).
  447.  
  448.   ext2 does not force you to choose large blocks for large file systems,
  449.   except for very large file systems in the 0.5 TB range (that's
  450.   terabytes with 1 TB equaling 1024 GB) and above, where small block
  451.   sizes become inefficient. So unlike DOS there is no need to split up
  452.   large disks into multiple partitions to keep block size down. Use the
  453.   1 KB default block size if possible. You may want to experiment with a
  454.   block size of 2 KB for some partitions, but expect to meet some seldom
  455.   exercised bugs: Most people use the default.
  456.  
  457.   3.5.  File lifetimes and backup cycles as partitioning criteria
  458.  
  459.   With ext2, Partitioning decisions should be governed by backup
  460.   considerations and to avoid external fragmentation from different file
  461.   lifetimes.
  462.  
  463.   Files have lifetimes. After a file has been created, it will remain
  464.   some time on the system and then be removed. File lifetime varies
  465.   greatly throughout the system and is partly dependent on the pathname
  466.   of the file. For example, files in /bin, /sbin, /usr/sbin, /usr/bin
  467.   and similar directories are likely to have a very long lifetime: many
  468.   months and above.  Files in /home are likely to have a medium
  469.   lifetime: several weeks or so. File in /var are usually short lived:
  470.   Almost no file in /var/spool/news will remain longer than a few days,
  471.   files in /var/spool/lpd measure their lifetime in minutes or less.
  472.  
  473.   For backup it is useful if the amount of daily backup is smaller than
  474.   the capacity of a single backup medium. A daily backup can be a
  475.   complete backup or an incremental backup.
  476.  
  477.   You can decide to keep your partition sizes small enough that they fit
  478.   completely onto one backup medium (choose daily full backups). In any
  479.   case a partition should be small enough that its daily delta (all
  480.   modified files) fits onto one backup medium (choose incremental backup
  481.   and expect to change backup media for the weekly/monthly full dump -
  482.   no unattended operation possible).
  483.  
  484.   Your backup strategy depends on that decision.
  485.  
  486.   When planning and buying disk space, remember to set aside a
  487.   sufficient amount of money for backup! Unbackuped data is worthless!
  488.   Data reproduction costs are much higher than backup costs for
  489.   virtually everyone!
  490.   For performance it is useful to keep files of different lifetimes on
  491.   different partitions. This way the short lived files on the news
  492.   partition may be fragmented very heavily.  This has no impact on the
  493.   performance of the / or /home partition.
  494.  
  495.   4.  An example
  496.  
  497.   4.1.  A recommended model for ambitious beginners
  498.  
  499.   A common model creates /, /home and /var partitions as discussed
  500.   above. This is simple to install and maintain and differentiates well
  501.   enough to avoid adverse effects from different lifetimes. It fits well
  502.   into a backup model, too:  Almost noone bothers to backup USENET news
  503.   spools and only some files in /var are worth backing up
  504.   (/var/spool/mail comes to mind). On the other hand, / changes
  505.   infrequently and can be backuped upon demand (after configuration
  506.   changes) and is small enough to fit on most modern backup media as a
  507.   full backup (plan 250 to 500 MB depending on the amount of installed
  508.   software). /home contains valuable user data and should be backuped
  509.   daily.  Some installations have very large /homes and must use
  510.   incremental backups.
  511.  
  512.   Some systems put /tmp onto a seperate partition as well, others
  513.   symlink it to /var/tmp to achieve the same effect (note that this can
  514.   affect single user mode, where /var will be unavailable and the system
  515.   will have no /tmp until you create one or mount /var manually) or put
  516.   it onto a RAM disk (Solaris does this for example). This keeps /tmp
  517.   out of /, a good idea.
  518.  
  519.   This model is convenient for upgrades or reinstallations as well: Save
  520.   your configuration files (or the entire /etc) to some /home directory,
  521.   scrap your /, reinstall and fetch the old configurations from the save
  522.   directory on /home.
  523.  
  524.   5.  How I did it on my machine
  525.  
  526.   There was this old ISA bus 386/40 sitting on my shelf that I abandoned
  527.   two years ago because it no longer cut it. I was planning to turn it
  528.   into a small X-less server for my household LAN.
  529.  
  530.   Here is how I did it: I took that 386 and put 16 MB RAM into it.
  531.   Added a cheap EIDE disk, the smallest I could get (800 MB) and an
  532.   ethernet card. Added an old Hercules because I still had a monitor for
  533.   it. Installed Linux on it and there I have my local NFS, SMB, HTTP,
  534.   LPD/LPR and NNTP server as well as my mail router and POP3 server.
  535.   With an additional ISDN card the machine became my TCP/IP router and
  536.   firewall, too.
  537.  
  538.   Most of the disk space on this machine went into the /var directories,
  539.   /var/spool/mail, /var/spool/news and /var/httpd/html. I put /var on a
  540.   separate partition and made this one large. There will be almost no
  541.   users on this machine, so I created no home partition and mounted
  542.   /home from some other workstation via NFS.
  543.  
  544.   Linux without X plus several locally installed utilities will be fine
  545.   with a 250 MB partition as /. The machine has 16 MB of RAM, but it
  546.   will be running many servers. 16 MB swap should be in order, 32 MB
  547.   should be plenty. We are not short on disk space, so the machine will
  548.   get 32 MB.  Out of sentimentality a MS-DOS partition of some 20 MB is
  549.   kept on it.  I decided to import /home from another machine, so the
  550.   remaining 500+ MB will end up as /var. This is more than sufficient
  551.   for a household USENET news feed.
  552.   We get
  553.  
  554.        ______________________________________________________________________
  555.        Device     Mounted on                      Size
  556.        /dev/hda1  /dos_c                           25 MB
  557.        /dev/hda2  - (Swapspace)                    32 MB
  558.        /dev/hda3  /                               250 MB
  559.        /dev/hda4  - (Extended Container)          500 MB
  560.        /dev/hda5  /var                            500 MB
  561.  
  562.        homeserver:/home /home                     1.6 GB
  563.        ______________________________________________________________________
  564.  
  565.   I am backing up this machine via the network using the tape in
  566.   homeserver. Since everything on this machine has been installed from
  567.   CD-ROM all I have to save are some configuration files from /etc, my
  568.   customized locally installed *.tgz files from /root/Source/Installed
  569.   and /var/spool/mail as well as /var/httpd/html.  I copy these files
  570.   into a dedicated directory /home/backmeup on homeserver every night,
  571.   where the regular homeserver backup picks them up.
  572.  
  573.